<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a="http://richfaces.org/a4j"
	xmlns:mtg="http://www.patelski.myself/jsf"
	xmlns:rich="http://richfaces.org/rich" template="layout/template.xhtml">

	<ui:define name="body">

		<h:form id="edition" styleClass="edit" enctype="multipart/form-data">

			<rich:panel>
				<f:facet name="header">#{editionHome.managed ? 'Edit' : 'Add'} User</f:facet>

				<rich:tabPanel style=" width : 100%; " switchType="client">
					<rich:tab id="editionData" style="width: 100%; "
						label="Edition info" styleClass="tab">

						<h:panelGrid columns="1" style="width: 100%; " cellpadding="2px"
							cellspacing="2px">
							<h:panelGrid columns="2"
								columnClasses="editionData, editionPicture"
								style=" width : 100%; " cellpadding="2px" cellspacing="2px">
								<rich:panel style="width : 100%; ">
									<f:facet name="header">
										<h:outputText rendered="#{not editionHome.managed}"
											value="New" styleClass="header" />
										<h:outputText rendered="#{editionHome.managed}"
											value="#{editionHome.instance.name}" styleClass="header" />
									</f:facet>
									<h:panelGrid columns="2" style="width : 100%; "
										cellpadding="2px" cellspacing="2px">

										<s:decorate id="idDecoration" template="layout/edit.xhtml">
											<ui:define name="label">Key</ui:define>
											<h:inputText id="id" required="true" size="20" maxlength="45"
												value="#{editionHome.instance.id}">
												<a:support event="onblur" reRender="idDecoration"
													bypassUpdates="true" />
											</h:inputText>
										</s:decorate>

										<s:decorate id="editionNameDecoration"
											template="layout/edit.xhtml">
											<ui:define name="label">Name</ui:define>
											<h:inputText id="name" size="20" maxlength="45"
												value="#{editionHome.instance.name}">
												<a:support event="onblur" reRender="editionNameDecoration"
													bypassUpdates="true" />
											</h:inputText>
										</s:decorate>

										<s:decorate id="blockNameDecoration"
											template="layout/edit.xhtml">
											<ui:define name="label">Block name</ui:define>
											<h:inputText id="blockName" required="false" size="20"
												maxlength="45" value="#{editionHome.instance.blockName}">
												<a:support event="onblur" reRender="blockNameDecoration"
													bypassUpdates="true" />
											</h:inputText>
										</s:decorate>

										<s:decorate id="releaseDateDecoration"
											template="layout/edit.xhtml">
											<ui:define name="label">Release-date</ui:define>
											<rich:calendar id="releaseDate"
												value="#{editionHome.instance.releaseDate}"
												pattern="dd-MM-yyyy" />
										</s:decorate>
										<s:decorate id="printSizeDecoration"
											template="layout/edit.xhtml">
											<ui:define name="label">Print-size</ui:define>
											<h:inputText id="printSize"
												value="#{editionHome.instance.printSize}">
												<a:support event="onblur" reRender="printSizeDecoration"
													bypassUpdates="true" />
											</h:inputText>
										</s:decorate>




                                        <s:decorate id="editionCategorieDecoration" template="layout/edit.xhtml">
                                            <ui:define name="label">Categorie</ui:define>
                                            <h:selectOneMenu value="#{editionHome.instance.editionCategorie}">
                                                <s:selectItems value="#{enumLists.editionCategorieArray}" var="editionCategorie"
                                                    label="#{editionCategorie.name}" />
                                            </h:selectOneMenu>
                                        </s:decorate>




										<s:decorate id="descriptionDecoration"
											template="layout/edit.xhtml">
											<ui:define name="label">Description</ui:define>
											<h:inputTextarea value="#{editionHome.instance.description}"
												id="description" cols="20" rows="4">
												<a:support event="onblur" reRender="descriptionDecoration"
													bypassUpdates="true" />
											</h:inputTextarea>
										</s:decorate>
										<s:decorate id="pictureDecoration"
											template="layout/edit.xhtml">
											<ui:define name="label">Picture</ui:define>
											<s:fileUpload id="uploadExpansionSymbol"
												styleClass="fileUpload"
												data="#{editionHome.uploadExpansionSymbol}" accept="image/*"
												size="40" maxlength="40" required="false" />
										</s:decorate>

										<s:decorate id="sortOrderDecoration"
											template="layout/edit.xhtml">
											<ui:define name="label">Sort order</ui:define>
											<h:inputText id="sortOrder" required="false" size="20"
												maxlength="45" value="#{editionHome.instance.sortOrder}">
												<a:support event="onblur" reRender="sortOrderDecoration"
													bypassUpdates="true" />
											</h:inputText>
										</s:decorate>
									</h:panelGrid>
								</rich:panel>

								<rich:panel>
									<f:facet name="header">
										<h:outputText value="#{editionHome.instance.name}"
											styleClass="header" />
									</f:facet>
									<rich:panel>
										<mtg:photo src="#{editionHome.instance.expansionSymbol}" />
									</rich:panel>
								</rich:panel>
							</h:panelGrid>
						</h:panelGrid>
					</rich:tab>
				</rich:tabPanel>
			</rich:panel>
			<div class="actionButtons"><h:commandButton id="save"
				value="Save" action="#{editionHome.persist}"
				disabled="#{!editionHome.wired}" rendered="#{!editionHome.managed}" />
			<h:commandButton id="update" value="Save"
				action="#{editionHome.update}" rendered="#{editionHome.managed}" />
			<h:commandButton id="delete" value="Delete"
				action="#{editionHome.remove}" rendered="#{editionHome.managed}" />
			<s:button id="done" value="Done" propagation="end"
				view="/Edition.xhtml" rendered="#{editionHome.managed}" /> <s:button
				id="cancel" value="Cancel" propagation="end"
				view="/#{empty editionFrom ? 'EditionList' : editionFrom}.xhtml"
				rendered="#{!editionHome.managed}" /></div>
		</h:form>
	</ui:define>

</ui:composition>
